Xbasic

load_compiled_script Function

Syntax

P LOAD_COMPILED_SCRIPT(C Name,B code)

Arguments

NameCharacter

Character

codeBinary

B

Description

Loads a compiled script so that it can be referenced through a code pointer.

Create a Binary Image

Create a binary image using the EXE_Get() method on the object returned by compile_template().

dim ptr as P
dim script as C
script = <<%code%
#function foo as C (msg as C)
#    ui_msg_box("Favorite Database", msg)
#end function
#%code%


ptr = compile_template(script)
dim exe_image as b = ptr.EXE_Get()
file.to_blob("c:\myImages\test.a5bin",exe_image)

Load a previously Created binary image

Once you have a compiled image, instead of requiring a parse, the xbasic binary source can be directly loaded and executed.

dim exe_image as b = file.from_blob("c:\myImages\test.a5bin")
dim ptr2 as p = load_compiled_script("test",exe_image)
ptr2.foo("Alpha Anywhere")